<?php
namespace Tlf\Scrawl\Ext\DefaultExt;
/**
* Copies the README.md file from docsrc to the `project_dir/README.md`
*/
class CopyReadme extends \Tlf\Scrawl\ExtensionType\DefaultExt {
/**
* Copy the .docsrc/readme file to project_root/readme.md
*/
public function onPreWriteFiles(){
if ($this->scrawl->getConfig('readme.copyFromDocs')[0]===true){
$readme = $this->scrawl->getOutput('file', '/README.md');
$prefix = $this->scrawl->pathToRootFrom('docs');
if ($readme!=null){
$this->scrawl->addOutput('file', $prefix.'README.md', $readme);
}
}
}
}